#ifndef BASEMODEL_H
#define BASEMODEL_H

#include <QObject>

#include "baseconnection.h"

class BaseModel : public QObject
{
    Q_OBJECT

public:
    explicit BaseModel(QObject *parent = 0);

    virtual QString toString() = 0;

    int getUpdateRate();
    GCSCommon::ConnectionStatus getConnectionStatus();

    virtual int *getIPAddress() = 0;


protected:
    int _updateRate;

    virtual void createConnection() = 0;
    virtual void destroyConnection() = 0;
    virtual BaseConnection *getConnection() = 0;

private:
    long _lastUpdateTimestamp;

signals:
    void pingTestCompleted(int pingResult);
    void valuesUpdated();

    void ipAddressHasBeenChanged();

public slots:
    void passOnPingTestResults(int pingResult);
    void runPingTest();
    virtual void processData(QString incomingData) = 0;

    virtual void changeIPAddress(int *newIPAddress) = 0;

};

#endif // BASEMODEL_H
